home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / Direct3D / MFCTex / mfctex.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-31  |  5.2 KB  |  183 lines

  1. //-----------------------------------------------------------------------------
  2. // File: MFCTex.h
  3. //
  4. // Desc: Header file for a D3DIM app that uses MFC
  5. //
  6. //
  7. // Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
  8. //-----------------------------------------------------------------------------
  9. #ifndef D3D_MFC_APP_H
  10. #define D3D_MFC_APP_H
  11.  
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif
  15. #ifndef __AFXWIN_H__
  16. #error include 'stdafx.h' before including this file
  17. #endif
  18.  
  19. #include "resource.h"
  20.  
  21.  
  22.  
  23.  
  24. //-----------------------------------------------------------------------------
  25. // Name: class CAppDoc
  26. // Desc: Overridden CDocument class needed for the CFormView
  27. //-----------------------------------------------------------------------------
  28. class CAppDoc : public CDocument
  29. {
  30. protected:
  31.     DECLARE_DYNCREATE(CAppDoc)
  32.  
  33. // Overrides
  34.     // ClassWizard generated virtual function overrides
  35.     //{{AFX_VIRTUAL(CAppDoc)
  36.     public:
  37.     //}}AFX_VIRTUAL
  38.  
  39. // Implementation
  40.     //{{AFX_MSG(CAppDoc)
  41.         // NOTE - the ClassWizard will add and remove member functions here.
  42.         //    DO NOT EDIT what you see in these blocks of generated code !
  43.     //}}AFX_MSG
  44.     DECLARE_MESSAGE_MAP()
  45. };
  46.  
  47.  
  48.  
  49.  
  50. //-----------------------------------------------------------------------------
  51. // Name: class CAppFrameWnd
  52. // Desc: CFrameWnd-based class needed to override the CFormView's window style
  53. //-----------------------------------------------------------------------------
  54. class CAppFrameWnd : public CFrameWnd
  55. {
  56. protected:
  57.     DECLARE_DYNCREATE(CAppFrameWnd)
  58. public:
  59.     // ClassWizard generated virtual function overrides
  60.     //{{AFX_VIRTUAL(CAppFrameWnd)
  61.     public:
  62.     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
  63.     //}}AFX_VIRTUAL
  64.  
  65. protected:
  66.     //{{AFX_MSG(CAppFrameWnd)
  67.     //}}AFX_MSG
  68.     DECLARE_MESSAGE_MAP()
  69. };
  70.  
  71.  
  72.  
  73.  
  74. //-----------------------------------------------------------------------------
  75. // Name: class CApp
  76. // Desc: Main MFCapplication class derived from CWinApp.
  77. //-----------------------------------------------------------------------------
  78. class CApp : public CWinApp
  79. {
  80. public:
  81.  
  82. // Overrides
  83.     // ClassWizard generated virtual function overrides
  84.     //{{AFX_VIRTUAL(CApp)
  85.     public:
  86.     virtual BOOL InitInstance();
  87.     virtual BOOL OnIdle( LONG );
  88.     //}}AFX_VIRTUAL
  89.  
  90. // Implementation
  91.     //{{AFX_MSG(CApp)
  92.     //}}AFX_MSG
  93.     DECLARE_MESSAGE_MAP()
  94. };
  95.  
  96.  
  97.  
  98.  
  99. //-----------------------------------------------------------------------------
  100. // Name: class CAppForm
  101. // Desc: CFormView-based class which allows the UI to be created with a form
  102. //       (dialog) resource. This class manages all the controls on the form.
  103. //-----------------------------------------------------------------------------
  104. class CAppForm : public CFormView, public CD3DApplication
  105. {
  106. private:
  107.     CD3DFont*  m_pFont;              // Font for drawing text
  108.     HWND       m_hwndRenderWindow;
  109.     HWND       m_hwndRenderFullScreen;
  110.  
  111.     TCHAR      m_strFileName[MAX_PATH];
  112.     TCHAR      m_strInitialDir[MAX_PATH];
  113.  
  114.     CComboBox *m_pTex0ColorArg1, *m_pTex0ColorOp, *m_pTex0ColorArg2;
  115.     CComboBox *m_pTex0AlphaArg1, *m_pTex0AlphaOp, *m_pTex0AlphaArg2;
  116.     CComboBox *m_pTex1ColorArg1, *m_pTex1ColorOp, *m_pTex1ColorArg2;
  117.     CComboBox *m_pTex1AlphaArg1, *m_pTex1AlphaOp, *m_pTex1AlphaArg2;
  118.     CComboBox *m_pTex2ColorArg1, *m_pTex2ColorOp, *m_pTex2ColorArg2;
  119.     CComboBox *m_pTex2AlphaArg1, *m_pTex2AlphaOp, *m_pTex2AlphaArg2;
  120.  
  121.     PDIRECT3DVERTEXBUFFER8 m_pVBWalls;
  122.     PDIRECT3DVERTEXBUFFER8 m_pVBFloorCeiling;
  123.  
  124.     HRESULT ConfirmDevice( D3DCAPS8*,DWORD,D3DFORMAT );
  125.     HRESULT OneTimeSceneInit();
  126.     HRESULT InitDeviceObjects();
  127.     HRESULT RestoreDeviceObjects();
  128.     HRESULT FrameMove();
  129.     HRESULT Render();
  130.     HRESULT InvalidateDeviceObjects();
  131.     HRESULT DeleteDeviceObjects();
  132.     HRESULT FinalCleanup();
  133.     virtual HRESULT AdjustWindowForChange();
  134.  
  135.     VOID    UpdateUIForDeviceCapabilites();
  136.     VOID    InitializeUIControls();
  137.     VOID    UpdateStageColor( WORD stage, LONG op, LONG arg1, LONG arg2 );
  138.     VOID    UpdateStageAlpha( WORD stage, LONG op, LONG arg1, LONG arg2 );
  139.     VOID    SetTextureMaps( const TCHAR*, const TCHAR*, const TCHAR* );
  140.  
  141. public:
  142.     BOOL IsReady() { return m_bReady; }
  143.     TCHAR* PstrFrameStats() { return m_strFrameStats; }
  144.     VOID RenderScene() { Render3DEnvironment(); }
  145.     HRESULT CheckForLostFullscreen();
  146.  
  147. protected:
  148.     DECLARE_DYNCREATE(CAppForm)
  149.  
  150.              CAppForm();
  151.     virtual  ~CAppForm();
  152. public:
  153.     //{{AFX_DATA(CAppForm)
  154.     enum { IDD = IDD_FORMVIEW };
  155.     //}}AFX_DATA
  156.  
  157.     //{{AFX_VIRTUAL(CAppForm)
  158.     virtual void OnInitialUpdate();
  159.     //}}AFX_VIRTUAL
  160.  
  161.     //{{AFX_MSG(CAppForm)
  162.     afx_msg VOID OnToggleFullScreen();
  163.     afx_msg VOID OnViewCode();
  164.     afx_msg VOID OnChangeDevice();
  165.     afx_msg VOID OnChangePresetEffects();
  166.     afx_msg VOID OnChangeTex();
  167.     afx_msg VOID OnSelectTexture0Name();
  168.     afx_msg VOID OnSelectTexture1Name();
  169.     afx_msg VOID OnSelectTexture2Name();
  170.     afx_msg VOID OnChangeBlendFactor();
  171.     afx_msg VOID OnChangeDiffuseColor();
  172.     afx_msg VOID OnChangeStageArgs();
  173.     //}}AFX_MSG
  174.     DECLARE_MESSAGE_MAP()
  175. };
  176.  
  177.  
  178.  
  179.  
  180. #endif
  181.  
  182.  
  183.